// app/service/user.js
const { Service } = require('egg').Service;

class UserService extends Service {
  // async find(uid) {
  //   const user = await this.ctx.db.query('select * from user where uid = ?', uid);
  //   return user;
  // }
  // 然后就能在 Controller 或 Service 的 app.mysql 中获取到 mysql 对象，例如：
  async find(uid) {
    const user = await this.app.mysql.get('users', { id: 11 });
    return { user }
  }
}

module.exports = UserService;